#include<bits/stdc++.h>
using namespace std;
const int N=1e5+100;
int n;
int r[N];
int s[N];
bool v[N];
int main(){
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
	cin>>n;
	int sum=0;
	for(int i=1;i<=n;i++){
		cin>>r[i];
		if(!v[r[i]]){
			sum++;
			v[r[i]]=1;
		}
	}
	for(int i=n;i>=1;i--){
		for(int j=i-1;j>=1;j--){
			if(r[i]>r[j]){
				int temp=r[i];
				r[i]=r[j];
				r[j]=temp;
			}
		}
	}
	int k=sum;
	s[k]++;
	for(int i=2;i<=n;i++){
		if(r[i]<r[i-1])k--;
		s[k]++;
	}
	int ans=n;
	int a=sum;
	int b=1;
	while(a>b){
		if(s[b]<s[a]){
			ans-=s[b];
			s[a]-=s[b];
			s[b]=0;
			b++;
		}
		if(s[b]==s[a]){
			ans-=s[b];
			s[a]=s[b]=0;
			a--;
			b++;
		}
		if(s[b]>s[a]){
			ans-=s[a];
			s[b]-=s[a];
			s[a]=0;
			a--;
		}
	}
	cout<<ans<<"\n";
	return 0;
}
